<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
xmlns:eop="http://www.opengis.net/eop/2.1" 
xmlns:opt="http://www.opengis.net/opt/2.1" 
xmlns:sar="http://www.opengis.net/sar/2.1" 
xmlns:atm="http://www.opengis.net/atm/2.1" 
xmlns:alt="http://www.opengis.net/alt/2.1" 
xmlns:lmb="http://www.opengis.net/lmb/2.1" 
xmlns:ssp="http://www.opengis.net/ssp/2.1" 
xmlns:gml="http://www.opengis.net/gml/3.2" 
xmlns:om="http://www.opengis.net/om/2.0" 
xmlns:xlink="http://www.w3.org/1999/xlink" 
xmlns:ows="http://www.opengis.net/ows/2.0" 
xmlns:stl="http://pisa.intecs.it/stl" 
xmlns:swe="http://www.opengis.net/swe/1.0" version="4.0">
	<!--xsl:param name="sType">RADAR LIMB ATMOSPHERIC ALTIMETRIC OPTICAL</xsl:param-->
        <xsl:character-map name="a">
            <xsl:output-character character="&#34;" string="&#34;"/>
        </xsl:character-map>
	<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no" use-character-maps="a"/>
	<xsl:param name="sType">OPTICAL</xsl:param>
	<xsl:template match="model">
		<xsl:apply-templates select="generalConstant"/>
		<!--File generated by the Feed via Velocity-->
		<xsl:choose>
			<xsl:when test="$sType = 'RADAR' ">
				<sar:EarthObservation gml:id="ID_$KEY">
					<xsl:call-template name="fillEO"/>
				</sar:EarthObservation>
			</xsl:when>
			<xsl:when test="$sType  = 'OPTICAL'">
				<opt:EarthObservation gml:id="ID_$KEY">
					<xsl:call-template name="fillEO"/>
				</opt:EarthObservation>
			</xsl:when>
			<xsl:when test="$sType  = 'ATMOSPHERIC'">
				<atm:EarthObservation gml:id="ID_$KEY">
					<xsl:call-template name="fillEO"/>
				</atm:EarthObservation>
			</xsl:when>
			<xsl:when test="$sType  = 'ALTIMETRIC'">
				<alt:EarthObservation gml:id="ID_$KEY">
					<xsl:call-template name="fillEO"/>
				</alt:EarthObservation>
			</xsl:when>
			<xsl:when test="$sType  = 'LIMB'">
				<lmb:EarthObservation gml:id="ID_$KEY">
					<xsl:call-template name="fillEO"/>
				</lmb:EarthObservation>
			</xsl:when>
			<xsl:when test="$sType  = 'SSP'">
				<ssp:EarthObservation gml:id="ID_$KEY">
					<xsl:call-template name="fillEO"/>
				</ssp:EarthObservation>
			</xsl:when>
			<xsl:otherwise>
				<eop:EarthObservation gml:id="ID_$KEY">
					<xsl:call-template name="fillEO"/>
				</eop:EarthObservation>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="fillEO">
		<om:phenomenonTime>
			<gml:TimePeriod gml:id="tp_$KEY">
				<gml:beginPosition>
					<xsl:apply-templates select="attribute[@id='beginAcquisition']"/>
				</gml:beginPosition>
				<gml:endPosition>
					<xsl:apply-templates select="attribute[@id='endAcquisition']"/>
				</gml:endPosition>
			</gml:TimePeriod>
		</om:phenomenonTime>
		<om:resultTime>
                        <xsl:if test="attribute[@id='availabilityTime'] != ''">
                            <xsl:if test="attribute[@id='availabilityTime']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='availabilityTime']/indexFieldName"/> != '' )</xsl:if>
                            <gml:TimeInstant gml:id="archivingdate_$KEY">
                                    <gml:timePosition>
                                            <xsl:apply-templates select="attribute[@id='availabilityTime']"/>
                                    </gml:timePosition>
                            </gml:TimeInstant>
                            <xsl:if test="attribute[@id='availabilityTime']/indexFieldName != ''">#end</xsl:if>	                        
                        </xsl:if>
                </om:resultTime>
		<om:procedure>
			<xsl:choose>
				<xsl:when test="$sType  = 'ALTIMETRIC'">
					<alt:EarthObservationEquipment gml:id="eoe_$KEY">
						<xsl:call-template name="fillEOE"/>
					</alt:EarthObservationEquipment>
				</xsl:when>
				<xsl:when test="$sType  = 'LIMB'">
					<lmb:EarthObservationEquipment gml:id="eoe_$KEY">
						<xsl:call-template name="fillEOE"/>
					</lmb:EarthObservationEquipment>
				</xsl:when>
				<xsl:when test="$sType  = 'SSP'">
					<ssp:EarthObservationEquipment gml:id="eoe_$KEY">
						<xsl:call-template name="fillEOE"/>
					</ssp:EarthObservationEquipment>
				</xsl:when>
				<xsl:otherwise>
					<eop:EarthObservationEquipment gml:id="eoe_$KEY">
						<xsl:call-template name="fillEOE"/>
					</eop:EarthObservationEquipment>
				</xsl:otherwise>
			</xsl:choose>
		</om:procedure>
		<xsl:choose> 
		<xsl:when test="attribute[@id='observedProperty'] != ''">
			<xsl:if test="attribute[@id='observedProperty']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='observedProperty']/indexFieldName"/> != '' )</xsl:if>
					<om:observedProperty xlink:href="">
							<xsl:attribute name="xlink:href"><xsl:apply-templates select="attribute[@id='observedProperty']"/></xsl:attribute>
					</om:observedProperty>
			<xsl:if test="attribute[@id='observedProperty']/indexFieldName != ''">#end</xsl:if>	
		</xsl:when>
		 <xsl:otherwise>
			<xsl:if test="attribute[@id='observedPropertyNilReason']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='observedPropertyNilReason']/indexFieldName"/> != '' )</xsl:if>
					<om:observedProperty nilReason="">
							<xsl:attribute name="nilReason"><xsl:apply-templates select="attribute[@id='observedPropertyNilReason']"/></xsl:attribute>
					</om:observedProperty>
			<xsl:if test="attribute[@id='observedPropertyNilReason']/indexFieldName != ''">#end</xsl:if>
		 </xsl:otherwise>			
		</xsl:choose>		
		<om:featureOfInterest>
			<xsl:choose>
				<xsl:when test="$sType  = 'ALTIMETRIC'">
					<alt:Footprint gml:id="fp_$KEY">
						<xsl:call-template name="fillFP"/>
					</alt:Footprint>
				</xsl:when>
				<xsl:when test="$sType  = 'LIMB'">
					<lmb:Footprint gml:id="fp_$KEY">
						<xsl:call-template name="fillFP"/>
					</lmb:Footprint>
				</xsl:when>
				<xsl:otherwise>
					<eop:Footprint gml:id="fp_$KEY">
						<xsl:call-template name="fillFP"/>
					</eop:Footprint>
				</xsl:otherwise>
			</xsl:choose>
		</om:featureOfInterest>
		<om:result>
			<xsl:choose>
				<xsl:when test="$sType  = 'OPTICAL'">
					<opt:EarthObservationResult gml:id="eor_$KEY">
						<xsl:call-template name="fillEOR"/>
					</opt:EarthObservationResult>
				</xsl:when>
				<xsl:when test="$sType  = 'ATMOSPHERIC'">
					<atm:EarthObservationResult gml:id="eor_$KEY">
						<xsl:call-template name="fillEOR"/>
					</atm:EarthObservationResult>
				</xsl:when>
				<xsl:when test="$sType  = 'SSP'">
					<atm:EarthObservationResult gml:id="eor_$KEY">
						<xsl:call-template name="fillEOR"/>
					</atm:EarthObservationResult>
				</xsl:when>
				<!-- no more required
					<xsl:when test="$sType  = 'RADAR'">
					<sar:EarthObservationResult gml:id="eor_$KEY">
						<xsl:call-template name="fillEOR"/>
					</sar:EarthObservationResult>
				</xsl:when>-->
				<!-- no more required
					<xsl:when test="$sType  = 'ALTIMETRIC'">
					<alt:EarthObservationResult gml:id="eor_$KEY">
						<xsl:call-template name="fillEOR"/>
					</alt:EarthObservationResult>
				</xsl:when>-->
				<!-- no more required
					<xsl:when test="$sType  = 'LIMB'">
					<lmb:EarthObservationResult gml:id="eor_$KEY">
						<xsl:call-template name="fillEOR"/>
					</lmb:EarthObservationResult>
				</xsl:when>-->
				<xsl:otherwise>
					<eop:EarthObservationResult gml:id="eor_$KEY">
						<xsl:call-template name="fillEOR"/>
					</eop:EarthObservationResult>
				</xsl:otherwise>
			</xsl:choose>
		</om:result>
		<eop:metaDataProperty>
			<xsl:choose>
				<xsl:when test="$sType  = 'SSP'">
					<ssp:EarthObservationMetaData>
						<xsl:call-template name="fillEOM"/>
					</ssp:EarthObservationMetaData>
				</xsl:when>
				<xsl:otherwise>
					<eop:EarthObservationMetaData>
						<xsl:call-template name="fillEOM"/>
					</eop:EarthObservationMetaData>
				</xsl:otherwise>
			</xsl:choose>
		</eop:metaDataProperty>
	</xsl:template>
	<xsl:template name="fillAcq">
		<!--TODO with eop:acquisitions 0..1 -->
		<xsl:if test="attribute[@id='orbitNumber'] != ''">
			<xsl:if test="attribute[@id='orbitNumber']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='orbitNumber']/indexFieldName"/> != '' )</xsl:if>
			<eop:orbitNumber>
				<xsl:apply-templates select="attribute[@id='orbitNumber']"/>
			</eop:orbitNumber>
			<xsl:if test="attribute[@id='orbitNumber']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="attribute[@id='lastOrbitNumber'] != ''">
			<xsl:if test="attribute[@id='lastOrbitNumber']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='lastOrbitNumber']/indexFieldName"/> != '' )</xsl:if>
			<eop:lastOrbitNumber>
				<xsl:apply-templates select="attribute[@id='lastOrbitNumber']"/>
			</eop:lastOrbitNumber>
			<xsl:if test="attribute[@id='lastOrbitNumber']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="attribute[@id='orbitDirection'] != ''">
			<xsl:if test="attribute[@id='orbitDirection']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='orbitDirection']/indexFieldName"/> != '' )</xsl:if>
			<eop:orbitDirection>
				<xsl:apply-templates select="attribute[@id='orbitDirection']"/>
			</eop:orbitDirection>
			<xsl:if test="attribute[@id='orbitDirection']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="attribute[@id='wrsLongitudeGrid'] != ''">
			<xsl:if test="attribute[@id='wrsLongitudeGrid']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='wrsLongitudeGrid']/indexFieldName"/> != '' )</xsl:if>
			<eop:wrsLongitudeGrid codeSpace="EPSG">
				<xsl:apply-templates select="attribute[@id='wrsLongitudeGrid']"/>
			</eop:wrsLongitudeGrid>
			<xsl:if test="attribute[@id='wrsLongitudeGrid']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="attribute[@id='wrsLatitudeGrid'] != ''">
			<xsl:if test="attribute[@id='wrsLatitudeGrid']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='wrsLatitudeGrid']/indexFieldName"/> != '' )</xsl:if>
			<eop:wrsLatitudeGrid codeSpace="EPSG">
				<xsl:apply-templates select="attribute[@id='wrsLatitudeGrid']"/>
			</eop:wrsLatitudeGrid>
			<xsl:if test="attribute[@id='wrsLatitudeGrid']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="attribute[@id='ascendingNodeDate'] != ''">
			<xsl:if test="attribute[@id='ascendingNodeDate']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='ascendingNodeDate']/indexFieldName"/> != '' )</xsl:if>
			<eop:ascendingNodeDate>
				<xsl:apply-templates select="attribute[@id='ascendingNodeDate']"/>
			</eop:ascendingNodeDate>
			<xsl:if test="attribute[@id='ascendingNodeDate']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="attribute[@id='ascendingNodeLongitude'] != ''">
			<xsl:if test="attribute[@id='ascendingNodeLongitude']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='ascendingNodeLongitude']/indexFieldName"/> != '' )</xsl:if>
			<eop:ascendingNodeLongitude uom="ms">
				<xsl:apply-templates select="attribute[@id='ascendingNodeLongitude']"/>
			</eop:ascendingNodeLongitude>
			<xsl:if test="attribute[@id='ascendingNodeLongitude']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="attribute[@id='startTimeFromAscendingNode'] != ''">
			<xsl:if test="attribute[@id='startTimeFromAscendingNode']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='startTimeFromAscendingNode']/indexFieldName"/> != '' )</xsl:if>
			<eop:startTimeFromAscendingNode uom="ms">
				<xsl:apply-templates select="attribute[@id='startTimeFromAscendingNode']"/>
			</eop:startTimeFromAscendingNode>
			<xsl:if test="attribute[@id='startTimeFromAscendingNode']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="attribute[@id='completionTimeFromAscendingNode'] != ''">
			<xsl:if test="attribute[@id='completionTimeFromAscendingNode']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='completionTimeFromAscendingNode']/indexFieldName"/> != '' )</xsl:if>
			<eop:completionTimeFromAscendingNode uom="ms">
				<xsl:apply-templates select="attribute[@id='completionTimeFromAscendingNode']"/>
			</eop:completionTimeFromAscendingNode>
			<xsl:if test="attribute[@id='completionTimeFromAscendingNode']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="attribute[@id='orbitDuration'] != ''">
			<xsl:if test="attribute[@id='orbitDuration']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='orbitDuration']/indexFieldName"/> != '' )</xsl:if>
			<eop:orbitDuration uom="ms">
				<xsl:apply-templates select="attribute[@id='orbitDuration']"/>
			</eop:orbitDuration>
			<xsl:if test="attribute[@id='orbitDuration']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="attribute[@id='illuminationAzimuthAngle'] != ''">
			<xsl:if test="attribute[@id='illuminationAzimuthAngle']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='illuminationAzimuthAngle']/indexFieldName"/> != '' )</xsl:if>
			<eop:illuminationAzimuthAngle uom="deg">
				<xsl:apply-templates select="attribute[@id='illuminationAzimuthAngle']"/>
			</eop:illuminationAzimuthAngle>
			<xsl:if test="attribute[@id='illuminationAzimuthAngle']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="attribute[@id='illuminationZenithAngle'] != ''">
			<xsl:if test="attribute[@id='illuminationZenithAngle']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='illuminationZenithAngle']/indexFieldName"/> != '' )</xsl:if>
			<eop:illuminationZenithAngle uom="deg">
				<xsl:apply-templates select="attribute[@id='illuminationZenithAngle']"/>
			</eop:illuminationZenithAngle>
			<xsl:if test="attribute[@id='illuminationZenithAngle']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="attribute[@id='illuminationElevationAngle'] != ''">
			<xsl:if test="attribute[@id='illuminationElevationAngle']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='illuminationElevationAngle']/indexFieldName"/> != '' )</xsl:if>
			<eop:illuminationElevationAngle uom="deg">
				<xsl:apply-templates select="attribute[@id='illuminationElevationAngle']"/>
			</eop:illuminationElevationAngle>
			<xsl:if test="attribute[@id='illuminationElevationAngle']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="attribute[@id='incidenceAngle'] != ''">
			<xsl:if test="attribute[@id='incidenceAngle']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='incidenceAngle']/indexFieldName"/> != '' )</xsl:if>
			<eop:incidenceAngle uom="deg">
				<xsl:apply-templates select="attribute[@id='incidenceAngle']"/>
			</eop:incidenceAngle>
			<xsl:if test="attribute[@id='incidenceAngle']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="attribute[@id='acrossTrackIncidenceAngle'] != ''">
			<xsl:if test="attribute[@id='acrossTrackIncidenceAngle']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='acrossTrackIncidenceAngle']/indexFieldName"/> != '' )</xsl:if>
			<eop:acrossTrackIncidenceAngle uom="deg">
				<xsl:apply-templates select="attribute[@id='acrossTrackIncidenceAngle']"/>
			</eop:acrossTrackIncidenceAngle>
			<xsl:if test="attribute[@id='acrossTrackIncidenceAngle']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="attribute[@id='alongTrackIncidenceAngle'] != ''">
			<xsl:if test="attribute[@id='alongTrackIncidenceAngle']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='alongTrackIncidenceAngle']/indexFieldName"/> != '' )</xsl:if>
			<eop:alongTrackIncidenceAngle uom="deg">
				<xsl:apply-templates select="attribute[@id='alongTrackIncidenceAngle']"/>
			</eop:alongTrackIncidenceAngle>
			<xsl:if test="attribute[@id='alongTrackIncidenceAngle']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="attribute[@id='instrumentAzimuthAngle'] != ''">
			<xsl:if test="attribute[@id='instrumentAzimuthAngle']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='instrumentAzimuthAngle']/indexFieldName"/> != '' )</xsl:if>
			<eop:instrumentAzimuthAngle uom="deg">
				<xsl:apply-templates select="attribute[@id='instrumentAzimuthAngle']"/>
			</eop:instrumentAzimuthAngle>
			<xsl:if test="attribute[@id='instrumentAzimuthAngle']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="attribute[@id='instrumentZenithAngle'] != ''">
			<xsl:if test="attribute[@id='instrumentZenithAngle']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='instrumentZenithAngle']/indexFieldName"/> != '' )</xsl:if>
			<eop:instrumentZenithAngle uom="deg">
				<xsl:apply-templates select="attribute[@id='instrumentZenithAngle']"/>
			</eop:instrumentZenithAngle>
			<xsl:if test="attribute[@id='instrumentZenithAngle']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="attribute[@id='instrumentElevationAngle'] != ''">
			<xsl:if test="attribute[@id='instrumentElevationAngle']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='instrumentElevationAngle']/indexFieldName"/> != '' )</xsl:if>
			<eop:instrumentElevationAngle uom="deg">
				<xsl:apply-templates select="attribute[@id='instrumentElevationAngle']"/>
			</eop:instrumentElevationAngle>
			<xsl:if test="attribute[@id='instrumentElevationAngle']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="attribute[@id='pitch'] != ''">
			<xsl:if test="attribute[@id='pitch']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='pitch']/indexFieldName"/> != '' )</xsl:if>
			<eop:pitch uom="deg">
				<xsl:apply-templates select="attribute[@id='pitch']"/>
			</eop:pitch>
			<xsl:if test="attribute[@id='pitch']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="attribute[@id='roll'] != ''">
			<xsl:if test="attribute[@id='roll']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='roll']/indexFieldName"/> != '' )</xsl:if>
			<eop:roll uom="deg">
				<xsl:apply-templates select="attribute[@id='roll']"/>
			</eop:roll>
			<xsl:if test="attribute[@id='roll']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="attribute[@id='yaw'] != ''">
			<xsl:if test="attribute[@id='yaw']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='yaw']/indexFieldName"/> != '' )</xsl:if>
			<eop:yaw uom="deg">
				<xsl:apply-templates select="attribute[@id='yaw']"/>
			</eop:yaw>
			<xsl:if test="attribute[@id='yaw']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="$sType  = 'RADAR'">
			<xsl:if test="attribute[@id='polarisationMode'] != ''">
				<xsl:if test="attribute[@id='polarisationMode']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='polarisationMode']/indexFieldName"/> != '' )</xsl:if>
				<sar:polarisationMode>
					<xsl:apply-templates select="attribute[@id='polarisationMode']"/>
				</sar:polarisationMode>
				<xsl:if test="attribute[@id='polarisationMode']/indexFieldName != ''">#end</xsl:if>
			</xsl:if>
			<xsl:if test="attribute[@id='polarisationChannels'] != ''">
				<xsl:if test="attribute[@id='polarisationChannels']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='polarisationChannels']/indexFieldName"/> != '' )</xsl:if>
				<sar:polarisationChannels>
					<xsl:apply-templates select="attribute[@id='polarisationChannels']"/>
				</sar:polarisationChannels>
				<xsl:if test="attribute[@id='polarisationChannels']/indexFieldName != ''">#end</xsl:if>
			</xsl:if>
			<xsl:if test="attribute[@id='antennaLookDirection'] != ''">
				<xsl:if test="attribute[@id='antennaLookDirection']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='antennaLookDirection']/indexFieldName"/> != '' )</xsl:if>
				<sar:antennaLookDirection>
					<xsl:apply-templates select="attribute[@id='antennaLookDirection']"/>
				</sar:antennaLookDirection>
				<xsl:if test="attribute[@id='antennaLookDirection']/indexFieldName != ''">#end</xsl:if>
			</xsl:if>
			<xsl:if test="attribute[@id='minimumIncidenceAngle'] != ''">
				<xsl:if test="attribute[@id='minimumIncidenceAngle']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='minimumIncidenceAngle']/indexFieldName"/> != '' )</xsl:if>
				<sar:minimumIncidenceAngle>
					<xsl:apply-templates select="attribute[@id='minimumIncidenceAngle']"/>
				</sar:minimumIncidenceAngle>
				<xsl:if test="attribute[@id='minimumIncidenceAngle']/indexFieldName != ''">#end</xsl:if>
			</xsl:if>
			<xsl:if test="attribute[@id='maximumIncidenceAngle'] != ''">
				<xsl:if test="attribute[@id='maximumIncidenceAngle']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='maximumIncidenceAngle']/indexFieldName"/> != '' )</xsl:if>
				<sar:maximumIncidenceAngle>
					<xsl:apply-templates select="attribute[@id='maximumIncidenceAngle']"/>
				</sar:maximumIncidenceAngle>
				<xsl:if test="attribute[@id='maximumIncidenceAngle']/indexFieldName != ''">#end</xsl:if>
			</xsl:if>
			<xsl:if test="attribute[@id='incidenceAngleVariation'] != ''">
				<xsl:if test="attribute[@id='incidenceAngleVariation']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='incidenceAngleVariation']/indexFieldName"/> != '' )</xsl:if>
				<sar:incidenceAngleVariation>
					<xsl:apply-templates select="attribute[@id='incidenceAngleVariation']"/>
				</sar:incidenceAngleVariation>
				<xsl:if test="attribute[@id='incidenceAngleVariation']/indexFieldName != ''">#end</xsl:if>
			</xsl:if>
			<xsl:if test="attribute[@id='dopplerFrequency'] != ''">
				<xsl:if test="attribute[@id='dopplerFrequency']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='dopplerFrequency']/indexFieldName"/> != '' )</xsl:if>
				<sar:dopplerFrequency>
					<xsl:apply-templates select="attribute[@id='dopplerFrequency']"/>
				</sar:dopplerFrequency>
				<xsl:if test="attribute[@id='dopplerFrequency']/indexFieldName != ''">#end</xsl:if>
			</xsl:if>
		</xsl:if>
		<xsl:if test="$sType  = 'ALTIMETRIC'">
			<xsl:if test="attribute[@id='cycleNumber'] != ''">
				<xsl:if test="attribute[@id='cycleNumber']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='cycleNumber']/indexFieldName"/> != '' )</xsl:if>
				<alt:cycleNumber>
					<xsl:apply-templates select="attribute[@id='cycleNumber']"/>
				</alt:cycleNumber>
				<xsl:if test="attribute[@id='cycleNumber']/indexFieldName != ''">#end</xsl:if>
			</xsl:if>
			<xsl:if test="attribute[@id='isSegment'] != ''">
				<xsl:if test="attribute[@id='isSegment']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='isSegment']/indexFieldName"/> != '' )</xsl:if>
				<alt:isSegment>
					<xsl:apply-templates select="attribute[@id='isSegment']"/>
				</alt:isSegment>
				<xsl:if test="attribute[@id='isSegment']/indexFieldName != ''">#end</xsl:if>
			</xsl:if>
			<xsl:if test="attribute[@id='relativePassNumber'] != ''">
				<xsl:if test="attribute[@id='relativePassNumber']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='relativePassNumber']/indexFieldName"/> != '' )</xsl:if>
				<alt:relativePassNumber>
					<xsl:apply-templates select="attribute[@id='relativePassNumber']"/>
				</alt:relativePassNumber>
				<xsl:if test="attribute[@id='relativePassNumber']/indexFieldName != ''">#end</xsl:if>
			</xsl:if>
		</xsl:if>
	</xsl:template>
	<xsl:template name="fillEOR">
		<xsl:if test="attribute[@id='browseType'] != ''">
			<eop:browse>
				<!--TODO 0..n-->
				<eop:BrowseInformation>
					<eop:type>
						<xsl:apply-templates select="attribute[@id='browseType']"/>
					</eop:type>
					<xsl:if test="attribute[@id='browseSubType'] != ''">
						<xsl:if test="attribute[@id='browseSubType']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='browseSubType']/indexFieldName"/> != '' )</xsl:if>
						<eop:subType>
							<xsl:apply-templates select="attribute[@id='browseSubType']"/>
						</eop:subType>
						<xsl:if test="attribute[@id='browseSubType']/indexFieldName != ''">#end</xsl:if>
					</xsl:if>
					<eop:referenceSystemIdentifier codeSpace="EPSG">
						<xsl:apply-templates select="attribute[@id='browseReferenceSystemIdentifier']"/>
					</eop:referenceSystemIdentifier>
					<eop:fileName>
						<ows:ServiceReference>
							<xsl:attribute name="xlink:href"><xsl:apply-templates select="attribute[@id='BrowseURI']"/></xsl:attribute>
							<ows:RequestMessage/>
						</ows:ServiceReference>
					</eop:fileName>
				</eop:BrowseInformation>
			</eop:browse>
		</xsl:if>
		<xsl:for-each select="attribute[@id='productURI']">
		<!--xsl:if test=". != ''"-->
			<eop:product>
				<eop:ProductInformation>
					<eop:fileName>
						<ows:ServiceReference xlink:href="">
							<xsl:attribute name="xlink:href"><xsl:apply-templates select="."/></xsl:attribute>
							<ows:RequestMessage/>
						</ows:ServiceReference>
					</eop:fileName>
					<xsl:if test="../attribute[@id='productReferenceSystemIdentifier'] != ''">
						<xsl:if test="../attribute[@id='productReferenceSystemIdentifier']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='../productReferenceSystemIdentifier']/indexFieldName"/> != '' )</xsl:if>
						<eop:referenceSystemIdentifier codeSpace="EPSG">
							<xsl:apply-templates select="../attribute[@id='productReferenceSystemIdentifier']"/>
						</eop:referenceSystemIdentifier>
						<xsl:if test="attribute[@id='../productReferenceSystemIdentifier']/indexFieldName != ''">#end</xsl:if>
					</xsl:if>
					<xsl:if test="../attribute[@id='productVersion'] != ''">
						<xsl:if test="../attribute[@id='productVersion']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="../attribute[@id='productVersion']/indexFieldName"/> != '' )</xsl:if>
						<eop:version>
							<xsl:apply-templates select="../attribute[@id='productVersion']"/>
						</eop:version>
						<xsl:if test="../attribute[@id='productVersion']/indexFieldName != ''">#end</xsl:if>
					</xsl:if>
					<xsl:if test="../attribute[@id='productSize'] != ''">
						<xsl:if test="../attribute[@id='productSize']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="../attribute[@id='productSize']/indexFieldName"/> != '' )</xsl:if>
						<eop:size uom="kb">
							<xsl:apply-templates select="../attribute[@id='productSize']"/>
						</eop:size>
						<xsl:if test="../attribute[@id='productSize']/indexFieldName != ''">#end</xsl:if>
					</xsl:if>
					<!--Timeliness of the product, such as "near real time", "rush". Possible values are mission specific and 
					shall refer to mission/ground segment dedicated codeSpace. 
					Example of values could be "NRT" or "NOMINAL"
				-->
					<xsl:if test="../attribute[@id='productTimeliness'] != ''">
						<xsl:if test="../attribute[@id='productTimeliness']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="../attribute[@id='productTimeliness']/indexFieldName"/> != '' )</xsl:if>
						<eop:timeliness>
							<xsl:apply-templates select="../attribute[@id='productTimeliness']"/>
						</eop:timeliness>
						<xsl:if test="../attribute[@id='productTimeliness']/indexFieldName != ''">#end</xsl:if>
					</xsl:if>
				</eop:ProductInformation>
			</eop:product>
		<!--/xsl:if-->		
		</xsl:for-each>
                <xsl:for-each select="attribute[@id='MaskURI']">
                    <!--xsl:if test="attribute[@id='maskType'] != ''"-->
                                <xsl:variable name="maskKey" select="@key"/>
                                <eop:mask>
                                    <eop:MaskInformation>
                                            <eop:type>
                                                    <xsl:apply-templates select="../attribute[@id='maskType' and @key=$maskKey]"/>
                                            </eop:type>
                                            <xsl:if test="../attribute[@id='maskSubType' and @key=$maskKey] != ''">
                                                    <xsl:if test="../attribute[@id='maskSubType' and @key=$maskKey]/indexFieldName != ''">#if( $metadata.<xsl:value-of select="../attribute[@id='maskSubType' and @key=$maskKey]/indexFieldName"/> != '' )</xsl:if>
                                                    <eop:subType>
                                                            <xsl:apply-templates select="../attribute[@id='maskSubType' and @key=$maskKey]"/>
                                                    </eop:subType>
                                                    <xsl:if test="../attribute[@id='maskSubType' and @key=$maskKey]/indexFieldName != ''">#end</xsl:if>
                                            </xsl:if>
                                            <eop:format>
                                                    <xsl:apply-templates select="../attribute[@id='maskFormat' and @key=$maskKey]"/>
                                            </eop:format>
                                            <xsl:if test="../attribute[@id='maskReferenceSystemIdentifier' and @key=$maskKey] != ''">
                                                    <xsl:if test="../attribute[@id='maskReferenceSystemIdentifier' and @key=$maskKey]/indexFieldName != ''">#if( $metadata.<xsl:value-of select="../attribute[@id='maskReferenceSystemIdentifier' and @key=$maskKey]/indexFieldName"/> != '' )</xsl:if>
                                                    <eop:referenceSystemIdentifier codeSpace="EPSG">
                                                            <xsl:apply-templates select="../attribute[@id='maskReferenceSystemIdentifier' and @key=$maskKey]"/>
                                                    </eop:referenceSystemIdentifier>
                                                    <xsl:if test="../attribute[@id='maskReferenceSystemIdentifier' and @key=$maskKey]/indexFieldName != ''">#end</xsl:if>
                                            </xsl:if>
                                            <xsl:if test="../attribute[@id='MaskURI'  and @key=$maskKey] != ''">
                                                    <xsl:if test="../attribute[@id='MaskURI' and @key=$maskKey]/indexFieldName != ''">#if( $metadata.<xsl:value-of select="../attribute[@id='MaskURI' and @key=$maskKey]/indexFieldName"/> != '' )</xsl:if>
                                                    <eop:fileName>
                                                            <ows:ServiceReference xlink:href="">
                                                                    <xsl:attribute name="xlink:href"><xsl:apply-templates select="../attribute[@id='MaskURI' and @key=$maskKey]"/></xsl:attribute>
                                                                    <ows:RequestMessage/>
                                                            </ows:ServiceReference>
                                                    </eop:fileName>
                                                    <xsl:if test="../attribute[@id='MaskURI' and @key=$maskKey]/indexFieldName != ''">#end</xsl:if>
                                            </xsl:if>
                                            <!--TBD Contains inline encoded mask polygon geometries using the gml:MultiSurface/gml:SurfaceMembers/gml:Polygon constructs.
                    0..1 (either fileName or multiExtentOf shall be provided)-->
                                            <!--multiExtentOf>
                                                    <gml:MultiSurface>
                                                            <gml:SurfaceMembers>
                                                                    <gml:Polygon>
                                                                    </gml:Polygon>
                                                            </gml:SurfaceMembers>
                                                    </gml:MultiSurface>
                                            </multiExtentOf-->
                                    </eop:MaskInformation>
                            </eop:mask>
                    <!--/xsl:if-->
                </xsl:for-each>
		<xsl:if test="attribute[@id='phenomenonName'] != ''">
			<eop:parameter>
				<!--TODO 0..1 -->
				<eop:ParameterInformation>
					<xsl:if test="attribute[@id='unitOfMeasure'] != ''">
						<xsl:if test="attribute[@id='unitOfMeasure']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='unitOfMeasure']/indexFieldName"/> != '' )</xsl:if>
						<!--TODO 0..n -->
						<eop:unitOfMeasure uom="">
							<xsl:attribute name="uom"><xsl:apply-templates select="attribute[@id='unitOfMeasure']"/></xsl:attribute>
						</eop:unitOfMeasure>
						<xsl:if test="attribute[@id='unitOfMeasure']/indexFieldName != ''">#end</xsl:if>
					</xsl:if>
					<eop:phenomenon>
						<!--TODO 0..n -->
						<swe:Phenomenon xmlns:gml31="http://www.opengis.net/gml" gml31:id="ssh">
							<name xmlns="http://www.opengis.net/gml" codeSpace="http://www.cfconventions.org">
								<xsl:apply-templates select="attribute[@id='phenomenonName']"/>
							</name>
						</swe:Phenomenon>
					</eop:phenomenon>
				</eop:ParameterInformation>
			</eop:parameter>
		</xsl:if>
		<xsl:if test="attribute[@id='coverageURI'] != ''">
			<eop:coverage>
				<xsl:attribute name="xlink:href"><xsl:apply-templates select="attribute[@id='coverageURI']"/></xsl:attribute>
			</eop:coverage>
		</xsl:if>
		<xsl:if test="$sType  = 'OPTICAL'">
			<xsl:if test="attribute[@id='cloudCoverPercentage'] != ''">
				<xsl:if test="attribute[@id='cloudCoverPercentage']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='cloudCoverPercentage']/indexFieldName"/> != '' )</xsl:if>
				<opt:cloudCoverPercentage uom="%">
					<xsl:apply-templates select="attribute[@id='cloudCoverPercentage']"/>
				</opt:cloudCoverPercentage>
				<xsl:if test="attribute[@id='cloudCoverPercentage']/indexFieldName != ''">#end</xsl:if>
			</xsl:if>
			<xsl:if test="attribute[@id='cloudCoverPercentageAssessmentConfidence'] != ''">
				<xsl:if test="attribute[@id='cloudCoverPercentageAssessmentConfidence']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='cloudCoverPercentageAssessmentConfidence']/indexFieldName"/> != '' )</xsl:if>
				<opt:cloudCoverPercentageAssessmentConfidence uom="%">
					<xsl:apply-templates select="attribute[@id='cloudCoverPercentageAssessmentConfidence']"/>
				</opt:cloudCoverPercentageAssessmentConfidence>
				<xsl:if test="attribute[@id='cloudCoverPercentageAssessmentConfidence']/indexFieldName != ''">#end</xsl:if>
			</xsl:if>
			<xsl:if test="attribute[@id='cloudCoverPercentageQuotationMode'] != ''">
				<xsl:if test="attribute[@id='cloudCoverPercentageQuotationMode']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='cloudCoverPercentageQuotationMode']/indexFieldName"/> != '' )</xsl:if>
				<opt:cloudCoverPercentageQuotationMode>
					<xsl:apply-templates select="attribute[@id='cloudCoverPercentageQuotationMode']"/>
				</opt:cloudCoverPercentageQuotationMode>
				<xsl:if test="attribute[@id='cloudCoverPercentageQuotationMode']/indexFieldName != ''">#end</xsl:if>
			</xsl:if>
			<xsl:if test="attribute[@id='snowCoverPercentage'] != ''">
				<xsl:if test="attribute[@id='snowCoverPercentage']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='snowCoverPercentage']/indexFieldName"/> != '' )</xsl:if>
				<opt:snowCoverPercentage uom="%">
					<xsl:apply-templates select="attribute[@id='snowCoverPercentage']"/>
				</opt:snowCoverPercentage>
				<xsl:if test="attribute[@id='snowCoverPercentage']/indexFieldName != ''">#end</xsl:if>
			</xsl:if>
			<xsl:if test="attribute[@id='snowCoverPercentageAssessmentConfidence'] != ''">
				<xsl:if test="attribute[@id='snowCoverPercentageAssessmentConfidence']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='snowCoverPercentageAssessmentConfidence']/indexFieldName"/> != '' )</xsl:if>
				<opt:snowCoverPercentageAssessmentConfidence uom="%">
					<xsl:apply-templates select="attribute[@id='snowCoverPercentageAssessmentConfidence']"/>
				</opt:snowCoverPercentageAssessmentConfidence>
				<xsl:if test="attribute[@id='snowCoverPercentageAssessmentConfidence']/indexFieldName != ''">#end</xsl:if>
			</xsl:if>
			<xsl:if test="attribute[@id='snowCoverPercentageQuotationMode'] != ''">
				<xsl:if test="attribute[@id='snowCoverPercentageQuotationMode']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='snowCoverPercentageQuotationMode']/indexFieldName"/> != '' )</xsl:if>
				<opt:snowCoverPercentageQuotationMode>
					<xsl:apply-templates select="attribute[@id='snowCoverPercentageQuotationMode']"/>
				</opt:snowCoverPercentageQuotationMode>
				<xsl:if test="attribute[@id='snowCoverPercentageQuotationMode']/indexFieldName != ''">#end</xsl:if>
			</xsl:if>
		</xsl:if>
		<xsl:if test="$sType  = 'SSP'">
			<xsl:if test="attribute[@id='cloudCoverPercentage'] != ''">
				<xsl:if test="attribute[@id='cloudCoverPercentage']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='cloudCoverPercentage']/indexFieldName"/> != '' )</xsl:if>
				<ssp:cloudCoverPercentage uom="%">
					<xsl:apply-templates select="attribute[@id='cloudCoverPercentage']"/>
				</ssp:cloudCoverPercentage>
				<xsl:if test="attribute[@id='cloudCoverPercentage']/indexFieldName != ''">#end</xsl:if>
			</xsl:if>
			<xsl:if test="attribute[@id='cloudCoverPercentageAssessmentConfidence'] != ''">
				<xsl:if test="attribute[@id='cloudCoverPercentageAssessmentConfidence']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='cloudCoverPercentageAssessmentConfidence']/indexFieldName"/> != '' )</xsl:if>
				<ssp:cloudCoverPercentageAssessmentConfidence uom="%">
					<xsl:apply-templates select="attribute[@id='cloudCoverPercentageAssessmentConfidence']"/>
				</ssp:cloudCoverPercentageAssessmentConfidence>
				<xsl:if test="attribute[@id='cloudCoverPercentageAssessmentConfidence']/indexFieldName != ''">#end</xsl:if>
			</xsl:if>
			<xsl:if test="attribute[@id='cloudCoverPercentageQuotationMode'] != ''">
				<xsl:if test="attribute[@id='cloudCoverPercentageQuotationMode']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='cloudCoverPercentageQuotationMode']/indexFieldName"/> != '' )</xsl:if>
				<ssp:cloudCoverPercentageQuotationMode>
					<xsl:apply-templates select="attribute[@id='cloudCoverPercentageQuotationMode']"/>
				</ssp:cloudCoverPercentageQuotationMode>
				<xsl:if test="attribute[@id='cloudCoverPercentageQuotationMode']/indexFieldName != ''">#end</xsl:if>
			</xsl:if>
			<xsl:if test="attribute[@id='snowCoverPercentage'] != ''">
				<xsl:if test="attribute[@id='snowCoverPercentage']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='snowCoverPercentage']/indexFieldName"/> != '' )</xsl:if>
				<ssp:snowCoverPercentage uom="%">
					<xsl:apply-templates select="attribute[@id='snowCoverPercentage']"/>
				</ssp:snowCoverPercentage>
				<xsl:if test="attribute[@id='snowCoverPercentage']/indexFieldName != ''">#end</xsl:if>
			</xsl:if>
			<xsl:if test="attribute[@id='snowCoverPercentageAssessmentConfidence'] != ''">
				<xsl:if test="attribute[@id='snowCoverPercentageAssessmentConfidence']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='snowCoverPercentageAssessmentConfidence']/indexFieldName"/> != '' )</xsl:if>
				<ssp:snowCoverPercentageAssessmentConfidence uom="%">
					<xsl:apply-templates select="attribute[@id='snowCoverPercentageAssessmentConfidence']"/>
				</ssp:snowCoverPercentageAssessmentConfidence>
				<xsl:if test="attribute[@id='snowCoverPercentageAssessmentConfidence']/indexFieldName != ''">#end</xsl:if>
			</xsl:if>
			<xsl:if test="attribute[@id='snowCoverPercentageQuotationMode'] != ''">
				<xsl:if test="attribute[@id='snowCoverPercentageQuotationMode']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='snowCoverPercentageQuotationMode']/indexFieldName"/> != '' )</xsl:if>
				<ssp:snowCoverPercentageQuotationMode>
					<xsl:apply-templates select="attribute[@id='snowCoverPercentageQuotationMode']"/>
				</ssp:snowCoverPercentageQuotationMode>
				<xsl:if test="attribute[@id='snowCoverPercentageQuotationMode']/indexFieldName != ''">#end</xsl:if>
			</xsl:if>
		</xsl:if>
		<xsl:if test="$sType  = 'ATMOSPHERIC'">
			<xsl:if test="attribute[@id='speciesError'] != '' or attribute[@id='species'] != '' or attribute[@id='unit'] != '' or attribute[@id='verticalRange '] != '' or 
			attribute[@id='algorithmName'] != '' or attribute[@id='algorithmVersion'] != ''">
				<atm:dataLayers>
					<atm:DataLayer>
						<xsl:if test="attribute[@id='speciesError'] != ''">
							<xsl:if test="attribute[@id='speciesError']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='speciesError']/indexFieldName"/> != '' )</xsl:if>
							<atm:speciesError uom="%">
								<xsl:apply-templates select="attribute[@id='speciesError']"/>
							</atm:speciesError>
							<xsl:if test="attribute[@id='speciesError']/indexFieldName != ''">#end</xsl:if>
						</xsl:if>
						<xsl:if test="attribute[@id='species'] != ''">
							<xsl:if test="attribute[@id='species']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='species']/indexFieldName"/> != '' )</xsl:if>
							<atm:species>
								<xsl:apply-templates select="attribute[@id='species']"/>
							</atm:species>
							<xsl:if test="attribute[@id='species']/indexFieldName != ''">#end</xsl:if>
						</xsl:if>
						<xsl:if test="attribute[@id='unit'] != ''">
							<xsl:if test="attribute[@id='unit']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='unit']/indexFieldName"/> != '' )</xsl:if>
							<atm:unit>
								<xsl:apply-templates select="attribute[@id='unit']"/>
							</atm:unit>
							<xsl:if test="attribute[@id='unit']/indexFieldName != ''">#end</xsl:if>
						</xsl:if>
						<xsl:if test="attribute[@id='verticalRange'] != ''">
							<xsl:if test="attribute[@id='verticalRange']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='verticalRange']/indexFieldName"/> != '' )</xsl:if>
							<atm:verticalRange>
								<xsl:apply-templates select="attribute[@id='verticalRange']"/>
							</atm:verticalRange>
							<xsl:if test="attribute[@id='verticalRange']/indexFieldName != ''">#end</xsl:if>
						</xsl:if>
						<xsl:if test="attribute[@id='algorithmName'] != ''">
							<xsl:if test="attribute[@id='algorithmName']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='algorithmName']/indexFieldName"/> != '' )</xsl:if>
							<atm:algorithmName>
								<xsl:apply-templates select="attribute[@id='algorithmName']"/>
							</atm:algorithmName>
							<xsl:if test="attribute[@id='algorithmName']/indexFieldName != ''">#end</xsl:if>
						</xsl:if>
						<xsl:if test="attribute[@id='algorithmVersion'] != ''">
							<xsl:if test="attribute[@id='algorithmVersion']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='algorithmVersion']/indexFieldName"/> != '' )</xsl:if>
							<atm:algorithmVersion>
								<xsl:apply-templates select="attribute[@id='algorithmVersion']"/>
							</atm:algorithmVersion>
							<xsl:if test="attribute[@id='algorithmVersion']/indexFieldName != ''">#end</xsl:if>
						</xsl:if>
						<xsl:if test="attribute[@id='verticalResolution'] != ''">
							<xsl:if test="attribute[@id='ascendingNodeDate']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='ascendingNodeDate']/indexFieldName"/> != '' )</xsl:if>
							<atm:verticalResolution uom="m">
								<xsl:apply-templates select="attribute[@id='verticalResolution']"/>
								<xsl:if test="attribute[@id='ascendingNodeDate']/indexFieldName != ''">#end</xsl:if>
							</atm:verticalResolution>
						</xsl:if>
					</atm:DataLayer>
				</atm:dataLayers>
			</xsl:if>
			<xsl:if test="attribute[@id='cloudCoverPercentage'] != ''">
				<xsl:if test="attribute[@id='cloudCoverPercentage']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='cloudCoverPercentage']/indexFieldName"/> != '' )</xsl:if>
				<atm:cloudCoverPercentage uom="%">
					<xsl:apply-templates select="attribute[@id='cloudCoverPercentage']"/>
				</atm:cloudCoverPercentage>
				<xsl:if test="attribute[@id='cloudCoverPercentage']/indexFieldName != ''">#end</xsl:if>
			</xsl:if>
			<xsl:if test="attribute[@id='cloudCoverPercentageAssessmentConfidence'] != ''">
				<xsl:if test="attribute[@id='cloudCoverPercentageAssessmentConfidence']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='cloudCoverPercentageAssessmentConfidence']/indexFieldName"/> != '' )</xsl:if>
				<atm:cloudCoverPercentageAssessmentConfidence uom="%">
					<xsl:apply-templates select="attribute[@id='cloudCoverPercentageAssessmentConfidence']"/>
				</atm:cloudCoverPercentageAssessmentConfidence>
				<xsl:if test="attribute[@id='cloudCoverPercentageAssessmentConfidence']/indexFieldName != ''">#end</xsl:if>
			</xsl:if>
			<xsl:if test="attribute[@id='cloudCoverPercentageQuotationMode'] != ''">
				<xsl:if test="attribute[@id='cloudCoverPercentageQuotationMode']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='cloudCoverPercentageQuotationMode']/indexFieldName"/> != '' )</xsl:if>
				<atm:cloudCoverPercentageQuotationMode>
					<xsl:apply-templates select="attribute[@id='cloudCoverPercentageQuotationMode']"/>
				</atm:cloudCoverPercentageQuotationMode>
				<xsl:if test="attribute[@id='cloudCoverPercentageQuotationMode']/indexFieldName != ''">#end</xsl:if>
			</xsl:if>
			<xsl:if test="attribute[@id='snowCoverPercentage'] != ''">
				<xsl:if test="attribute[@id='snowCoverPercentage']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='snowCoverPercentage']/indexFieldName"/> != '' )</xsl:if>
				<atm:snowCoverPercentage uom="%">
					<xsl:apply-templates select="attribute[@id='snowCoverPercentage']"/>
				</atm:snowCoverPercentage>
				<xsl:if test="attribute[@id='snowCoverPercentage']/indexFieldName != ''">#end</xsl:if>
			</xsl:if>
			<xsl:if test="attribute[@id='snowCoverPercentageAssessmentConfidence'] != ''">
				<xsl:if test="attribute[@id='snowCoverPercentageAssessmentConfidence']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='snowCoverPercentageAssessmentConfidence']/indexFieldName"/> != '' )</xsl:if>
				<atm:snowCoverPercentageAssessmentConfidence uom="%">
					<xsl:apply-templates select="attribute[@id='snowCoverPercentageAssessmentConfidence']"/>
				</atm:snowCoverPercentageAssessmentConfidence>
				<xsl:if test="attribute[@id='snowCoverPercentageAssessmentConfidence']/indexFieldName != ''">#end</xsl:if>
			</xsl:if>
			<xsl:if test="attribute[@id='snowCoverPercentageQuotationMode'] != ''">
				<xsl:if test="attribute[@id='snowCoverPercentageQuotationMode']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='snowCoverPercentageQuotationMode']/indexFieldName"/> != '' )</xsl:if>
				<atm:snowCoverPercentageQuotationMode>
					<xsl:apply-templates select="attribute[@id='snowCoverPercentageQuotationMode']"/>
				</atm:snowCoverPercentageQuotationMode>
				<xsl:if test="attribute[@id='snowCoverPercentageQuotationMode']/indexFieldName != ''">#end</xsl:if>
			</xsl:if>
		</xsl:if>
	</xsl:template>
	<xsl:template name="fillEOE">
		<!--test if platform has an element (shortName exists)-->
		<!--shortName is not a unique id so it must be managed in a diffferent way-->
		<!--platform-->
		<xsl:choose>
			<xsl:when test="$sType = 'SSP' ">
				<!--TODO 0..n -->
				<ssp:platform>
					<xsl:call-template name="fillPlat"/>
				</ssp:platform>
			</xsl:when>
			<xsl:when test="$sType = 'ALTIMETRIC' ">
				<!--TODO 0..n -->
				<alt:platform>
					<xsl:call-template name="fillPlat"/>
				</alt:platform>
			</xsl:when>
			<xsl:otherwise>
				<eop:platform>
					<xsl:call-template name="fillPlat"/>
				</eop:platform>
			</xsl:otherwise>
		</xsl:choose>
		<!--instrument-->
		<xsl:choose>
			<xsl:when test="$sType = 'SSP' ">
				<!--TODO 0..n -->
				<ssp:instrument>
					<eop:Instrument>
						<eop:shortName>
							<xsl:apply-templates select="attribute[@id='instrumentShortName']"/>
						</eop:shortName>
					</eop:Instrument>
				</ssp:instrument>
			</xsl:when>
			<xsl:otherwise>
				<eop:instrument>
					<eop:Instrument>
						<eop:shortName>
							<xsl:apply-templates select="attribute[@id='instrumentShortName']"/>
						</eop:shortName>
						<xsl:if test="attribute[@id='description'] != ''">
							<xsl:if test="attribute[@id='description']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='description']/indexFieldName"/> != '' )</xsl:if>
							<eop:description>
								<xsl:apply-templates select="attribute[@id='instrumentDescription']"/>
							</eop:description>
							<xsl:if test="attribute[@id='description']/indexFieldName != ''">#end</xsl:if>
						</xsl:if>
						<xsl:if test="attribute[@id='instrumentType'] != ''">
							<xsl:if test="attribute[@id='instrumentType']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='instrumentType']/indexFieldName"/> != '' )</xsl:if>
							<eop:instrumentType>
								<xsl:apply-templates select="attribute[@id='instrumentType']"/>
							</eop:instrumentType>
							<xsl:if test="attribute[@id='instrumentType']/indexFieldName != ''">#end</xsl:if>
						</xsl:if>
					</eop:Instrument>
				</eop:instrument>
			</xsl:otherwise>
		</xsl:choose>
		<xsl:if test="$sType = 'ALTIMETRIC' ">
			<!--auxiliaryInstrument-->
			<xsl:if test="attribute[@id='auxInstrument'] != ''">
				<!--TODO 0..n -->
				<alt:auxiliaryInstrument>
					<alt:AuxiliaryInstrument>
						<eop:shortName>
							<xsl:apply-templates select="attribute[@id='auxInstrument']"/>
						</eop:shortName>
						<alt:instrumentType>
							<xsl:apply-templates select="attribute[@id='auxInstrumentType']"/>
						</alt:instrumentType>
					</alt:AuxiliaryInstrument>
				</alt:auxiliaryInstrument>
			</xsl:if>
		</xsl:if>
		<!--sensor-->
		<xsl:choose>
			<xsl:when test="$sType  = 'LIMB'">
				<lmb:sensor>
					<lmb:Sensor>
						<xsl:call-template name="fillSens"/>
						<xsl:if test="attribute[@id='measurementType'] != ''">
							<xsl:if test="attribute[@id='measurementType']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='measurementType']/indexFieldName"/> != '' )</xsl:if>
							<lmb:measurementType>
								<xsl:apply-templates select="attribute[@id='measurementType']"/>
							</lmb:measurementType>
							<xsl:if test="attribute[@id='measurementType']/indexFieldName != ''">#end</xsl:if>
						</xsl:if>
					</lmb:Sensor>
				</lmb:sensor>
			</xsl:when>
			<xsl:otherwise>
				<eop:sensor>
					<eop:Sensor>
						<xsl:call-template name="fillSens"/>
					</eop:Sensor>
				</eop:sensor>
			</xsl:otherwise>
		</xsl:choose>
		<!-- we should include here an IF to check if at least one of the element is included in the config file-->
		<!--acquisitionParameters-->
		<xsl:choose>
			<xsl:when test="$sType  = 'RADAR'">
				<eop:acquisitionParameters>
					<sar:Acquisition>
						<xsl:call-template name="fillAcq"/>
					</sar:Acquisition>
				</eop:acquisitionParameters>
			</xsl:when>
			<xsl:when test="$sType  = 'ALTIMETRIC'">
				<eop:acquisitionParameters>
					<alt:Acquisition>
						<xsl:call-template name="fillAcq"/>
					</alt:Acquisition>
				</eop:acquisitionParameters>
			</xsl:when>
			<xsl:when test="$sType  = 'LIMB'">
				<lmb:acquisitionParameters>
					<lmb:Acquisition>
						<xsl:call-template name="fillAcq"/>
						<xsl:if test="attribute[@id='observationMode'] != ''">
							<xsl:if test="attribute[@id='observationMode']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='observationMode']/indexFieldName"/> != '' )</xsl:if>
							<lmb:observationMode>
								<xsl:apply-templates select="attribute[@id='observationMode']"/>
							</lmb:observationMode>
							<xsl:if test="attribute[@id='observationMode']/indexFieldName != ''">#end</xsl:if>
						</xsl:if>
						<xsl:if test="attribute[@id='verticalResolution'] != ''">
							<xsl:if test="attribute[@id='verticalResolution']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='verticalResolution']/indexFieldName"/> != '' )</xsl:if>
							<lmb:verticalResolution uom="m">
								<xsl:apply-templates select="attribute[@id='verticalResolution']"/>
							</lmb:verticalResolution>
							<xsl:if test="attribute[@id='verticalResolution']/indexFieldName != ''">#end</xsl:if>
						</xsl:if>
					</lmb:Acquisition>
				</lmb:acquisitionParameters>
			</xsl:when>
			<!--
				xsl:when test="$sType  = 'OPTICAL'">
                              
                                        <opt:Acquisition>
						<xsl:call-template name="fillAcq"/>
					</opt:Acquisition>
				</xsl:when>
				<xsl:when test="$sType  = 'ATMOSPHERIC'">
					<eop:acquisitionParameters>
                                            <atm:Acquisition>
						<xsl:call-template name="fillAcq"/>
                                            </atm:Acquisition>
                                            </eop:acquisitionParameters>
				</xsl:when>		
				-->
			<xsl:otherwise>
				<eop:acquisitionParameters>
					<eop:Acquisition>
						<xsl:call-template name="fillAcq"/>
					</eop:Acquisition>
				</eop:acquisitionParameters>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
	<xsl:template name="fillEOM">
		<eop:identifier>
			<xsl:apply-templates select="attribute[@id='productId']"/>
		</eop:identifier>
		<xsl:if test="attribute[@id='creationDate'] !=''">
			<xsl:if test="attribute[@id='creationDate']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='creationDate']/indexFieldName"/> != '' )</xsl:if>
			<eop:creationDate>
				<xsl:apply-templates select="attribute[@id='creationDate']"/>
			</eop:creationDate>
			<xsl:if test="attribute[@id='creationDate']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="attribute[@id='insertionDate'] !=''">
			<xsl:if test="attribute[@id='insertionDate']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='insertionDate']/indexFieldName"/> != '' )</xsl:if>
			<eop:insertionDate>
				<xsl:apply-templates select="attribute[@id='insertionDate']"/>
			</eop:insertionDate>
			<xsl:if test="attribute[@id='insertionDate']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="attribute[@id='doi'] !=''">
			<xsl:if test="attribute[@id='doi']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='doi']/indexFieldName"/> != '' )</xsl:if>
			<eop:doi>
				<xsl:apply-templates select="attribute[@id='doi']"/>
			</eop:doi>
			<xsl:if test="attribute[@id='doi']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="attribute[@id='parentIdentifier'] !=''">
			<xsl:if test="attribute[@id='parentIdentifier']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='parentIdentifier']/indexFieldName"/> != '' )</xsl:if>
			<eop:parentIdentifier>
				<xsl:apply-templates select="attribute[@id='parentIdentifier']"/>
			</eop:parentIdentifier>
			<xsl:if test="attribute[@id='parentIdentifier']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<eop:acquisitionType>
			<xsl:apply-templates select="attribute[@id='acquisitionType']"/>
		</eop:acquisitionType>
		<xsl:if test="attribute[@id='acquisitionSubType'] !=''">
			<xsl:if test="attribute[@id='acquisitionSubType']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='acquisitionSubType']/indexFieldName"/> != '' )</xsl:if>
			<eop:acquisitionSubType>
				<xsl:apply-templates select="attribute[@id='acquisitionSubType']"/>
			</eop:acquisitionSubType>
			<xsl:if test="attribute[@id='acquisitionSubType']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="attribute[@id='productType'] !=''">
			<xsl:if test="attribute[@id='productType']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='productType']/indexFieldName"/> != '' )</xsl:if>
			<eop:productType>
				<xsl:apply-templates select="attribute[@id='productType']"/>
			</eop:productType>
			<xsl:if test="attribute[@id='productType']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<eop:status>
			<xsl:apply-templates select="attribute[@id='status']"/>
		</eop:status>
		<xsl:if test="attribute[@id='statusSubType'] !=''">
			<xsl:if test="attribute[@id='statusSubType']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='statusSubType']/indexFieldName"/> != '' )</xsl:if>
			<eop:statusSubType>
				<xsl:apply-templates select="attribute[@id='statusSubType']"/>
			</eop:statusSubType>
			<xsl:if test="attribute[@id='statusSubType']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="attribute[@id='statusDetail'] !=''">
			<xsl:if test="attribute[@id='statusDetail']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='statusDetail']/indexFieldName"/> != '' )</xsl:if>
			<eop:statusDetail>
				<xsl:apply-templates select="attribute[@id='statusDetail']"/>
			</eop:statusDetail>
			<xsl:if test="attribute[@id='statusDetail']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="attribute[@id='acquisitionStation'] !=''">
			<xsl:if test="attribute[@id='acquisitionStation']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='acquisitionStation']/indexFieldName"/> != '' )</xsl:if>
			<eop:downlinkedTo>
				<!--TODO 0..n-->
				<eop:DownlinkInformation>
					<eop:acquisitionStation codeSpace="urn:eop:PHR:stationCode">
						<xsl:apply-templates select="attribute[@id='acquisitionStation']"/>
					</eop:acquisitionStation>
					<xsl:if test="attribute[@id='acquisitionDate'] !=''">
						<xsl:if test="attribute[@id='acquisitionDate']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='acquisitionDate']/indexFieldName"/> != '' )</xsl:if>
						<eop:acquisitionDate>
							<xsl:apply-templates select="attribute[@id='acquisitionDate']"/>
						</eop:acquisitionDate>
						<xsl:if test="attribute[@id='acquisitionDate']/indexFieldName != ''">#end</xsl:if>
					</xsl:if>
				</eop:DownlinkInformation>
			</eop:downlinkedTo>
			<xsl:if test="attribute[@id='acquisitionStation']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="attribute[@id='archivingCenter'] !=''">
			<xsl:if test="attribute[@id='archivingCenter']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='archivingCenter']/indexFieldName"/> != '' )</xsl:if>
			<eop:archivedIn>
				<!--TODO 0..n-->
				<eop:ArchivingInformation>
					<eop:archivingCenter>
						<xsl:apply-templates select="attribute[@id='archivingCenter']"/>
					</eop:archivingCenter>
					<eop:archivingDate>
						<xsl:apply-templates select="attribute[@id='archivingDate']"/>
					</eop:archivingDate>
					<xsl:if test="attribute[@id='archivingIdentifier'] !=''">
						<xsl:if test="attribute[@id='archivingIdentifier']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='archivingIdentifier']/indexFieldName"/> != '' )</xsl:if>
						<eop:archivingIdentifier>
							<xsl:apply-templates select="attribute[@id='archivingIdentifier']"/>
						</eop:archivingIdentifier>
						<xsl:if test="attribute[@id='archivingIdentifier']/indexFieldName != ''">#end</xsl:if>
					</xsl:if>
				</eop:ArchivingInformation>
			</eop:archivedIn>
			<xsl:if test="attribute[@id='archivingCenter']/indexFieldName != ''">#end</xsl:if>
			</xsl:if>
		<!--	DEPRECATED		
				<xsl:if test="attribute[@id='imageQualityDegradation'] !=''">
					<eop:imageQualityDegradation uom="%">
						<xsl:apply-templates select="attribute[@id='imageQualityDegradation']"/>
					</eop:imageQualityDegradation>
				</xsl:if>
				<xsl:if test="attribute[@id='imageQualityStatus'] !=''">
					<eop:imageQualityStatus>
						<xsl:apply-templates select="attribute[@id='imageQualityStatus']"/>
					</eop:imageQualityStatus>
				</xsl:if>
				<xsl:if test="attribute[@id='imageQualityDegradationTag'] !=''">
					<eop:imageQualityDegradationTag>
						<xsl:apply-templates select="attribute[@id='imageQualityDegradationTag']"/>
					</eop:imageQualityDegradationTag>
				</xsl:if>
				<xsl:if test="attribute[@id='imageQualityReportURL'] !=''">
					<eop:imageQualityReportURL>
						<xsl:apply-templates select="attribute[@id='imageQualityReportURL']"/>
					</eop:imageQualityReportURL>
				</xsl:if>
				-->
		<xsl:if test="attribute[@id='productQualityStatus'] !=''">
			<xsl:if test="attribute[@id='productQualityStatus']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='productQualityStatus']/indexFieldName"/> != '' )</xsl:if>
			<eop:productQualityStatus>
				<xsl:apply-templates select="attribute[@id='productQualityStatus']"/>
			</eop:productQualityStatus>
			<xsl:if test="attribute[@id='productQualityStatus']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="attribute[@id='productQualityDegradationTag'] !=''">
			<xsl:if test="attribute[@id='productQualityDegradationTag']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='productQualityDegradationTag']/indexFieldName"/> != '' )</xsl:if>
			<eop:productQualityDegradationTag>
				<xsl:apply-templates select="attribute[@id='productQualityDegradationTag']"/>
			</eop:productQualityDegradationTag>
			<xsl:if test="attribute[@id='productQualityDegradationTag']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="attribute[@id='productQualityReportURL'] !=''">
			<xsl:if test="attribute[@id='productQualityReportURL']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='productQualityReportURL']/indexFieldName"/> != '' )</xsl:if>
			<eop:productQualityReportURL>
				<xsl:apply-templates select="attribute[@id='productQualityReportURL']"/>
			</eop:productQualityReportURL>
			<xsl:if test="attribute[@id='productQualityReportURL']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="attribute[@id='productQualityDegradation'] !=''">
			<xsl:if test="attribute[@id='productQualityDegradation']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='productQualityDegradation']/indexFieldName"/> != '' )</xsl:if>
			<eop:productQualityDegradation uom="%">
				<xsl:apply-templates select="attribute[@id='productQualityDegradation']"/>
			</eop:productQualityDegradation>
			<xsl:if test="attribute[@id='productQualityDegradation']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="attribute[@id='productQualityDegradationQuotationMode'] !=''">
			<xsl:if test="attribute[@id='productQualityDegradationQuotationMode']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='productQualityDegradationQuotationMode']/indexFieldName"/> != '' )</xsl:if>
			<eop:productQualityDegradationQuotationMode>
				<xsl:apply-templates select="attribute[@id='productQualityDegradationQuotationMode']"/>
			</eop:productQualityDegradationQuotationMode>
			<xsl:if test="attribute[@id='productQualityDegradationQuotationMode']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="attribute[@id='min'] !=''">
			<xsl:if test="attribute[@id='min']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='min']/indexFieldName"/> != '' )</xsl:if>
			<eop:histograms>
				<!--TODO 0..n-->
				<eop:Histogram>
					<xsl:if test="attribute[@id='bandId'] !=''">
						<xsl:if test="attribute[@id='bandId']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='bandId']/indexFieldName"/> != '' )</xsl:if>
						<eop:bandId>
							<xsl:apply-templates select="attribute[@id='bandId']"/>
						</eop:bandId>
						<xsl:if test="attribute[@id='bandId']/indexFieldName != ''">#end</xsl:if>
					</xsl:if>
					<eop:min>
						<xsl:apply-templates select="attribute[@id='min']"/>
					</eop:min>
					<eop:max>
						<xsl:apply-templates select="attribute[@id='max']"/>
					</eop:max>
					<xsl:if test="attribute[@id='mean'] !=''">
						<xsl:if test="attribute[@id='mean']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='mean']/indexFieldName"/> != '' )</xsl:if>
						<eop:mean>
							<xsl:apply-templates select="attribute[@id='mean']"/>
						</eop:mean>
						<xsl:if test="attribute[@id='mean']/indexFieldName != ''">#end</xsl:if>
					</xsl:if>
					<xsl:if test="attribute[@id='stdDeviation'] !=''">
						<xsl:if test="attribute[@id='stdDeviation']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='stdDeviation']/indexFieldName"/> != '' )</xsl:if>
						<eop:stdDeviation>
							<xsl:apply-templates select="attribute[@id='stdDeviation']"/>
						</eop:stdDeviation>
						<xsl:if test="attribute[@id='stdDeviation']/indexFieldName != ''">#end</xsl:if>
					</xsl:if>
				</eop:Histogram>
			</eop:histograms>
			<xsl:if test="attribute[@id='min']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<!--Link to an EO product that is part of this EO product (e.g. a phr:DataStrip is composed of one or more phr:Scene)-->
		<xsl:if test="attribute[@id='composedOf'] !=''">
			<xsl:if test="attribute[@id='composedOf']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='composedOf']/indexFieldName"/> != '' )</xsl:if>
			<eop:composedOf>
				<!--TODO 0..n -->
				<xsl:apply-templates select="attribute[@id='composedOf']"/>
			</eop:composedOf>
			<xsl:if test="attribute[@id='composedOf']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<!--Link to the “father” EO product (e.g. a phr:Scene is a subset of a phr:DataStrip)-->
		<xsl:if test="attribute[@id='subsetOf'] !=''">
			<xsl:if test="attribute[@id='subsetOf']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='subsetOf']/indexFieldName"/> != '' )</xsl:if>
			<eop:subsetOf>
				<!--TODO 0..n-->
				<xsl:apply-templates select="attribute[@id='subsetOf']"/>
			</eop:subsetOf>
			<xsl:if test="attribute[@id='subsetOf']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<!--Specify a link to another EO product (e.g. ERS1 and ERS2 interferometric pair) -->
		<xsl:if test="attribute[@id='linkedWith'] !=''">
			<xsl:if test="attribute[@id='linkedWith']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='linkedWith']/indexFieldName"/> != '' )</xsl:if>
			<eop:linkedWith>
				<!--TODO 0..n-->
				<xsl:apply-templates select="attribute[@id='linkedWith']"/>
			</eop:linkedWith>
			<xsl:if test="attribute[@id='linkedWith']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<eop:processing>
                        <!-- TO DO extend the IF to all the optional elements-->
			<xsl:if test="attribute[@id='processingMode'] !=''">
				<xsl:choose>
					<xsl:when test="$sType  = 'ALTIMETRIC'">
						<alt:ProcessingInformation>
							<xsl:if test="attribute[@id='processingCenter'] !=''">
								<xsl:if test="attribute[@id='processingCenter']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='processingCenter']/indexFieldName"/> != '' )</xsl:if>
								<eop:processingCenter codeSpace="http://dummy/mycentre">
									<xsl:apply-templates select="attribute[@id='processingCenter']"/>
								</eop:processingCenter>
								<xsl:if test="attribute[@id='processingCenter']/indexFieldName != ''">#end</xsl:if>
							</xsl:if>
							<xsl:if test="attribute[@id='processingDate'] !=''">
								<xsl:if test="attribute[@id='processingDate']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='processingDate']/indexFieldName"/> != '' )</xsl:if>
								<eop:processingDate>
									<xsl:apply-templates select="attribute[@id='processingDate']"/>
								</eop:processingDate>
								<xsl:if test="attribute[@id='processingDate']/indexFieldName != ''">#end</xsl:if>
							</xsl:if>
							<xsl:if test="attribute[@id='compositeType'] !=''">
								<xsl:if test="attribute[@id='compositeType']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='compositeType']/indexFieldName"/> != '' )</xsl:if>
								<eop:compositeType>
									<xsl:apply-templates select="attribute[@id='compositeType']"/>
								</eop:compositeType>
								<xsl:if test="attribute[@id='compositeType']/indexFieldName != ''">#end</xsl:if>
							</xsl:if>
							<xsl:if test="attribute[@id='method'] !=''">
								<xsl:if test="attribute[@id='method']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='method']/indexFieldName"/> != '' )</xsl:if>
								<eop:method>
									<xsl:apply-templates select="attribute[@id='method']"/>
								</eop:method>
								<xsl:if test="attribute[@id='method']/indexFieldName != ''">#end</xsl:if>
							</xsl:if>
							<xsl:if test="attribute[@id='methodVersion'] !=''">
								<xsl:if test="attribute[@id='methodVersion']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='methodVersion']/indexFieldName"/> != '' )</xsl:if>
								<eop:methodVersion>
									<xsl:apply-templates select="attribute[@id='methodVersion']"/>
								</eop:methodVersion>
								<xsl:if test="attribute[@id='methodVersion']/indexFieldName != ''">#end</xsl:if>
							</xsl:if>
                                                        <xsl:if test="attribute[@id='processorName'] !=''">
								<xsl:if test="attribute[@id='processorName']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='processorName']/indexFieldName"/> != '' )</xsl:if>
								<eop:processorName>
									<xsl:apply-templates select="attribute[@id='processorName']"/>
								</eop:processorName>
								<xsl:if test="attribute[@id='processorName']/indexFieldName != ''">#end</xsl:if>
							</xsl:if>
							<xsl:if test="attribute[@id='processorVersion'] !=''">
								<xsl:if test="attribute[@id='processorVersion']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='processorVersion']/indexFieldName"/> != '' )</xsl:if>
								<eop:processorVersion>
									<xsl:apply-templates select="attribute[@id='processorVersion']"/>
								</eop:processorVersion>
								<xsl:if test="attribute[@id='processorVersion']/indexFieldName != ''">#end</xsl:if>
							</xsl:if>
							<xsl:if test="attribute[@id='processingLevel'] !=''">
								<xsl:if test="attribute[@id='processingLevel']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='processingLevel']/indexFieldName"/> != '' )</xsl:if>
								<eop:processingLevel>
									<xsl:apply-templates select="attribute[@id='processingLevel']"/>
								</eop:processingLevel>
								<xsl:if test="attribute[@id='processingLevel']/indexFieldName != ''">#end</xsl:if>
							</xsl:if>
							<xsl:if test="attribute[@id='nativeProductFormat'] !=''">
								<xsl:if test="attribute[@id='nativeProductFormat']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='nativeProductFormat']/indexFieldName"/> != '' )</xsl:if>
								<eop:nativeProductFormat>
									<xsl:apply-templates select="attribute[@id='nativeProductFormat']"/>
								</eop:nativeProductFormat>
								<xsl:if test="attribute[@id='nativeProductFormat']/indexFieldName != ''">#end</xsl:if>
							</xsl:if>
							<xsl:if test="attribute[@id='auxiliaryDataSetFileName'] !=''">
								<xsl:if test="attribute[@id='auxiliaryDataSetFileName']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='auxiliaryDataSetFileName']/indexFieldName"/> != '' )</xsl:if>
								<eop:auxiliaryDataSetFileName>
									<xsl:apply-templates select="attribute[@id='auxiliaryDataSetFileName']"/>
								</eop:auxiliaryDataSetFileName>
								<xsl:if test="attribute[@id='auxiliaryDataSetFileName']/indexFieldName != ''">#end</xsl:if>
							</xsl:if>
                                                        <xsl:if test="attribute[@id='processingMode'] !=''">
                                                                <xsl:if test="attribute[@id='processingMode']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='processingMode']/indexFieldName"/> != '' )</xsl:if>
                                                                <eop:processingMode>
                                                                        <xsl:apply-templates select="attribute[@id='processingMode']"/>
                                                                </eop:processingMode>
                                                                <xsl:if test="attribute[@id='processingMode']/indexFieldName != ''">#end</xsl:if>
                                                        </xsl:if>
							<xsl:if test="attribute[@id='groundTrackUncertainty'] !=''">
								<xsl:if test="attribute[@id='groundTrackUncertainty']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='groundTrackUncertainty']/indexFieldName"/> != '' )</xsl:if>
								<alt:groundTrackUncertainty uom="km">
									<xsl:apply-templates select="attribute[@id='groundTrackUncertainty']"/>
								</alt:groundTrackUncertainty>
								<xsl:if test="attribute[@id='groundTrackUncertainty']/indexFieldName != ''">#end</xsl:if>
							</xsl:if>
							<xsl:if test="attribute[@id='productContentsType'] !=''">
								<xsl:if test="attribute[@id='productContentsType']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='productContentsType']/indexFieldName"/> != '' )</xsl:if>
								<alt:productContentsType>
									<xsl:apply-templates select="attribute[@id='productContentsType']"/>
								</alt:productContentsType>
								<xsl:if test="attribute[@id='productContentsType']/indexFieldName != ''">#end</xsl:if>
							</xsl:if>
							<xsl:if test="attribute[@id='samplingRate'] !=''">
								<xsl:if test="attribute[@id='samplingRate']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='samplingRate']/indexFieldName"/> != '' )</xsl:if>
								<alt:samplingRate uom="kHz">
									<xsl:apply-templates select="attribute[@id='samplingRate']"/>
								</alt:samplingRate>
								<xsl:if test="attribute[@id='samplingRate']/indexFieldName != ''">#end</xsl:if>
							</xsl:if>
						</alt:ProcessingInformation>
					</xsl:when>
					<xsl:otherwise>
						<eop:ProcessingInformation>
							<xsl:if test="attribute[@id='processingCenter'] !=''">
								<xsl:if test="attribute[@id='processingCenter']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='processingCenter']/indexFieldName"/> != '' )</xsl:if>
								<eop:processingCenter>
									<xsl:apply-templates select="attribute[@id='processingCenter']"/>
								</eop:processingCenter>
								<xsl:if test="attribute[@id='processingCenter']/indexFieldName != ''">#end</xsl:if>
							</xsl:if>
							<xsl:if test="attribute[@id='processingDate'] !=''">
								<xsl:if test="attribute[@id='processingDate']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='processingDate']/indexFieldName"/> != '' )</xsl:if>
								<eop:processingDate>
									<xsl:apply-templates select="attribute[@id='processingDate']"/>
								</eop:processingDate>
								<xsl:if test="attribute[@id='processingDate']/indexFieldName != ''">#end</xsl:if>
							</xsl:if>
							<xsl:if test="attribute[@id='compositeType'] !=''">
								<xsl:if test="attribute[@id='compositeType']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='compositeType']/indexFieldName"/> != '' )</xsl:if>
								<eop:compositeType>
									<xsl:apply-templates select="attribute[@id='compositeType']"/>
								</eop:compositeType>
								<xsl:if test="attribute[@id='compositeType']/indexFieldName != ''">#end</xsl:if>
							</xsl:if>
							<xsl:if test="attribute[@id='method'] !=''">
								<xsl:if test="attribute[@id='method']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='method']/indexFieldName"/> != '' )</xsl:if>
								<eop:method>
									<xsl:apply-templates select="attribute[@id='method']"/>
								</eop:method>
								<xsl:if test="attribute[@id='method']/indexFieldName != ''">#end</xsl:if>
							</xsl:if>
							<xsl:if test="attribute[@id='methodVersion'] !=''">
								<xsl:if test="attribute[@id='methodVersion']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='methodVersion']/indexFieldName"/> != '' )</xsl:if>
								<eop:methodVersion>
									<xsl:apply-templates select="attribute[@id='methodVersion']"/>
								</eop:methodVersion>
								<xsl:if test="attribute[@id='methodVersion']/indexFieldName != ''">#end</xsl:if>
							</xsl:if>
							<xsl:if test="attribute[@id='processorName'] !=''">
								<xsl:if test="attribute[@id='processorName']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='processorName']/indexFieldName"/> != '' )</xsl:if>
								<eop:processorName>
									<xsl:apply-templates select="attribute[@id='processorName']"/>
								</eop:processorName>
								<xsl:if test="attribute[@id='processorName']/indexFieldName != ''">#end</xsl:if>
							</xsl:if>
							<xsl:if test="attribute[@id='processorVersion'] !=''">
								<xsl:if test="attribute[@id='processorVersion']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='processorVersion']/indexFieldName"/> != '' )</xsl:if>
								<eop:processorVersion>
									<xsl:apply-templates select="attribute[@id='processorVersion']"/>
								</eop:processorVersion>
								<xsl:if test="attribute[@id='processorVersion']/indexFieldName != ''">#end</xsl:if>
							</xsl:if>
							<xsl:if test="attribute[@id='processingLevel'] !=''">
								<xsl:if test="attribute[@id='processingLevel']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='processingLevel']/indexFieldName"/> != '' )</xsl:if>
								<eop:processingLevel>
									<xsl:apply-templates select="attribute[@id='processingLevel']"/>
								</eop:processingLevel>
								<xsl:if test="attribute[@id='processingLevel']/indexFieldName != ''">#end</xsl:if>
							</xsl:if>
							<xsl:if test="attribute[@id='nativeProductFormat'] !=''">
								<xsl:if test="attribute[@id='nativeProductFormat']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='nativeProductFormat']/indexFieldName"/> != '' )</xsl:if>
								<eop:nativeProductFormat>
									<xsl:apply-templates select="attribute[@id='nativeProductFormat']"/>
								</eop:nativeProductFormat>
								<xsl:if test="attribute[@id='nativeProductFormat']/indexFieldName != ''">#end</xsl:if>
							</xsl:if>
							<xsl:if test="attribute[@id='auxiliaryDataSetFileName'] !=''">
								<xsl:if test="attribute[@id='auxiliaryDataSetFileName']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='auxiliaryDataSetFileName']/indexFieldName"/> != '' )</xsl:if>
								<eop:auxiliaryDataSetFileName>
									<xsl:apply-templates select="attribute[@id='auxiliaryDataSetFileName']"/>
								</eop:auxiliaryDataSetFileName>
								<xsl:if test="attribute[@id='auxiliaryDataSetFileName']/indexFieldName != ''">#end</xsl:if>
							</xsl:if>
                                               		<xsl:if test="attribute[@id='processingMode'] !=''">
								<xsl:if test="attribute[@id='processingMode']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='processingMode']/indexFieldName"/> != '' )</xsl:if>
								<eop:processingMode>
									<xsl:apply-templates select="attribute[@id='processingMode']"/>
								</eop:processingMode>
								<xsl:if test="attribute[@id='processingMode']/indexFieldName != ''">#end</xsl:if>
							</xsl:if>
						</eop:ProcessingInformation>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:if>
		</eop:processing>
		<xsl:if test="attribute[@id='productGroupId'] !=''">
			<xsl:if test="attribute[@id='productGroupId']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='productGroupId']/indexFieldName"/> != '' )</xsl:if>
			<eop:productGroupId>
				<xsl:apply-templates select="attribute[@id='productGroupId']"/>
			</eop:productGroupId>
			<xsl:if test="attribute[@id='productGroupId']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:for-each select="attribute[substring-before(@id,'-')='add']">
			<eop:vendorSpecific>
				<eop:SpecificInformation>
					<eop:localAttribute>
						<xsl:value-of select="substring-after(@id,'-')"/>
					</eop:localAttribute>
					<eop:localValue>
						<xsl:apply-templates select="."/>
					</eop:localValue>
				</eop:SpecificInformation>
			</eop:vendorSpecific>
		</xsl:for-each>
	</xsl:template>
	<xsl:template name="fillFP">
		<eop:multiExtentOf>
			<gml:MultiSurface gml:id="ms_$KEY" srsName="EPSG:4326">
				<gml:surfaceMembers>
					<gml:Polygon gml:id="fppoly_$KEY">
						<gml:exterior>
							<gml:LinearRing>
								<gml:posList>
									<xsl:apply-templates select="attribute[@id='footprint']"/>
								</gml:posList>
							</gml:LinearRing>
						</gml:exterior>
					</gml:Polygon>
				</gml:surfaceMembers>
			</gml:MultiSurface>
		</eop:multiExtentOf>
		<xsl:if test="attribute[@id='orientation'] !=''">
			<xsl:if test="attribute[@id='orientation']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='orientation']/indexFieldName"/> != '' )</xsl:if>
			<eop:orientation>
				<xsl:apply-templates select="attribute[@id='orientation']"/>
			</eop:orientation>
			<xsl:if test="attribute[@id='orientation']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="attribute[@id='footprintCenter'] !=''">
			<xsl:if test="attribute[@id='footprintCenter']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='footprintCenter']/indexFieldName"/> != '' )</xsl:if>
			<eop:centerOf>
				<gml:Point gml:id="pt_$KEY" srsName="EPSG:4326">
					<gml:pos>
						<xsl:apply-templates select="attribute[@id='footprintCenter']"/>
					</gml:pos>
				</gml:Point>
			</eop:centerOf>
			<xsl:if test="attribute[@id='footprintCenter']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="$sType  = 'ALTIMETRIC'">
			<alt:nominalTrack>
				<gml:MultiCurve gml:id="alt_$KEY">
					<gml:curveMember>
						<gml:LineString gml:id="track1" srsName="EPSG:4326">
							<gml:coordinates>
								<xsl:apply-templates select="attribute[@id='']"/>
							</gml:coordinates>
						</gml:LineString>
					</gml:curveMember>
				</gml:MultiCurve>
			</alt:nominalTrack>
		</xsl:if>
		<xsl:if test="$sType  = 'LIMB'">
			<xsl:if test="attribute[@id='maximumAltitude'] != ''">
				<xsl:if test="attribute[@id='maximumAltitude']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='maximumAltitude']/indexFieldName"/> != '' )</xsl:if>
				<lmb:maximumAltitude uom="m">
					<xsl:apply-templates select="attribute[@id='maximumAltitude']"/>
				</lmb:maximumAltitude>
				<xsl:if test="attribute[@id='maximumAltitude']/indexFieldName != ''">#end</xsl:if>
			</xsl:if>
			<xsl:if test="attribute[@id='minimumAltitude'] != ''">
				<xsl:if test="attribute[@id='minimumAltitude']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='minimumAltitude']/indexFieldName"/> != '' )</xsl:if>
				<lmb:minimumAltitude uom="m">
					<xsl:apply-templates select="attribute[@id='minimumAltitude']"/>
				</lmb:minimumAltitude>
				<xsl:if test="attribute[@id='minimumAltitude']/indexFieldName != ''">#end</xsl:if>
			</xsl:if>
			<lmb:nominalTrack>
				<gml:MultiCurve gml:id="lmb_$KEY">
					<gml:curveMember>
						<!--TODO: here we assume only one track-->
						<gml:LineString gml:id="track1" srsName="EPSG:4326">
							<gml:coordinates>
								<xsl:apply-templates select="attribute[@id='']"/>
							</gml:coordinates>
						</gml:LineString>
					</gml:curveMember>
				</gml:MultiCurve>
			</lmb:nominalTrack>
			<lmb:occultationPoints>
				<gml:MultiPoint gml:id="occ_$KEY" srsName="EPSG:4326">
					<gml:pointMember>
						<!--TODO: here we assume only one profile-->
						<gml:Point gml:id="profile1">
							<gml:coordinates>
								<xsl:apply-templates select="attribute[@id='']"/>
							</gml:coordinates>
						</gml:Point>
					</gml:pointMember>
				</gml:MultiPoint>
			</lmb:occultationPoints>
		</xsl:if>
		<xsl:if test="$sType  = 'SSP'">
			<xsl:if test="attribute[@id='locationName'] != ''">
				<xsl:if test="attribute[@id='locationName']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='locationName']/indexFieldName"/> != '' )</xsl:if>
				<gml:locationName>
					<xsl:apply-templates select="attribute[@id='locationName']"/>
				</gml:locationName>
				<xsl:if test="attribute[@id='locationName']/indexFieldName != ''">#end</xsl:if>
			</xsl:if>
		</xsl:if>
	</xsl:template>
	<xsl:template name="fillPlat">
		<eop:Platform>
			<eop:shortName>
				<xsl:apply-templates select="attribute[@id='platformShortName']"/>
			</eop:shortName>
			<xsl:if test="attribute[@id='platformSerialIdentifier'] != ''">
				<xsl:if test="attribute[@id='platformSerialIdentifier']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='platformSerialIdentifier']/indexFieldName"/> != '' )</xsl:if>
				<eop:serialIdentifier>
					<xsl:apply-templates select="attribute[@id='platformSerialIdentifier']"/>
				</eop:serialIdentifier>
				<xsl:if test="attribute[@id='platformSerialIdentifier']/indexFieldName != ''">#end</xsl:if>
			</xsl:if>
			<xsl:if test="attribute[@id='orbitType'] != ''">
				<xsl:if test="attribute[@id='orbitType']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='orbitType']/indexFieldName"/> != '' )</xsl:if>
				<eop:orbitType>
					<xsl:apply-templates select="attribute[@id='orbitType']"/>
				</eop:orbitType>
				<xsl:if test="attribute[@id='orbitType']/indexFieldName != ''">#end</xsl:if>
			</xsl:if>
		</eop:Platform>
	</xsl:template>
	<xsl:template name="fillSens">
		<xsl:if test="attribute[@id='sensorType'] != ''">
			<xsl:if test="attribute[@id='sensorType']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='sensorType']/indexFieldName"/> != '' )</xsl:if>
			<eop:sensorType>
				<xsl:apply-templates select="attribute[@id='sensorType']"/>
			</eop:sensorType>
			<xsl:if test="attribute[@id='sensorType']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<eop:operationalMode codeSpace="urn:eop:PHR:sensorMode">
			<xsl:apply-templates select="attribute[@id='operationalMode']"/>
		</eop:operationalMode>
		<xsl:if test="attribute[@id='resolution'] != ''">
			<xsl:if test="attribute[@id='resolution']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='resolution']/indexFieldName"/> != '' )</xsl:if>
			<eop:resolution uom="m">
				<xsl:apply-templates select="attribute[@id='resolution']"/>
			</eop:resolution>
			<xsl:if test="attribute[@id='resolution']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="attribute[@id='swathIdentifier'] != ''">
			<xsl:if test="attribute[@id='swathIdentifier']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='swathIdentifier']/indexFieldName"/> != '' )</xsl:if>
			<eop:swathIdentifier>
				<xsl:apply-templates select="attribute[@id='swathIdentifier']"/>
			</eop:swathIdentifier>
			<xsl:if test="attribute[@id='swathIdentifier']/indexFieldName != ''">#end</xsl:if>
			<xsl:if test="attribute[@id='ascendingNodeDate']/indexFieldName != ''">#end</xsl:if>
		</xsl:if>
		<xsl:if test="attribute[@id='discreteWavelengths'] != '' or attribute[@id='endWavelength'] != '' or attribute[@id='spectralRange'] != '' or attribute[@id='startWavelength'] != '' or attribute[@id='wavelengthResolution'] != ''">
			<eop:wavelengthInformation>
				<eop:WavelengthInformation>
					<xsl:if test="attribute[@id='discreteWavelengths'] != ''">
						<xsl:if test="attribute[@id='discreteWavelengths']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='discreteWavelengths']/indexFieldName"/> != '' )</xsl:if>
						<eop:discreteWavelengths>
							<gml:MeasureList uom="m">
								<xsl:apply-templates select="attribute[@id='discreteWavelengths']"/>
							</gml:MeasureList>
						</eop:discreteWavelengths>
						<xsl:if test="attribute[@id='discreteWavelengths']/indexFieldName != ''">#end</xsl:if>
					</xsl:if>
					<xsl:if test="attribute[@id='endWavelength'] != ''">
						<xsl:if test="attribute[@id='endWavelength']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='endWavelength']/indexFieldName"/> != '' )</xsl:if>
						<eop:endWavelength>
							<gml:Measure uom="m">
								<xsl:apply-templates select="attribute[@id='endWavelength']"/>
							</gml:Measure>
						</eop:endWavelength>
						<xsl:if test="attribute[@id='endWavelength']/indexFieldName != ''">#end</xsl:if>
					</xsl:if>
					<xsl:if test="attribute[@id='spectralRange'] != ''">
						<xsl:if test="attribute[@id='spectralRange']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='spectralRange']/indexFieldName"/> != '' )</xsl:if>
						<eop:spectralRange>
							<xsl:apply-templates select="attribute[@id='spectralRange']"/>
						</eop:spectralRange>
						<xsl:if test="attribute[@id='spectralRange']/indexFieldName != ''">#end</xsl:if>
					</xsl:if>
					<xsl:if test="attribute[@id='startWavelength'] != ''">
						<xsl:if test="attribute[@id='startWavelength']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='startWavelength']/indexFieldName"/> != '' )</xsl:if>
						<eop:startWavelength>
							<gml:Measure uom="m">
								<xsl:apply-templates select="attribute[@id='startWavelength']"/>
							</gml:Measure>
						</eop:startWavelength>
						<xsl:if test="attribute[@id='startWavelength']/indexFieldName != ''">#end</xsl:if>
					</xsl:if>
					<xsl:if test="attribute[@id='wavelengthResolution'] != ''">
						<xsl:if test="attribute[@id='wavelengthResolution']/indexFieldName != ''">#if( $metadata.<xsl:value-of select="attribute[@id='wavelengthResolution']/indexFieldName"/> != '' )</xsl:if>
						<eop:wavelengthResolution>
							<gml:Measure uom="m">
								<xsl:apply-templates select="attribute[@id='wavelengthResolution']"/>
							</gml:Measure>
						</eop:wavelengthResolution>
						<xsl:if test="attribute[@id='wavelengthResolution']/indexFieldName != ''">#end</xsl:if>
					</xsl:if>
				</eop:WavelengthInformation>
			</eop:wavelengthInformation>
		</xsl:if>
	</xsl:template>
	<xsl:template match="generalConstant ">
#set( $<xsl:value-of select="@name"/> = "<xsl:value-of select="."/>" )
</xsl:template>
	<xsl:template match="attribute">
		<xsl:apply-templates select="*"/>
	</xsl:template>
	<xsl:template match="defaultValue">
		<xsl:value-of select="."/>
	</xsl:template>
	<!--xsl:template match="indexFieldName">$metadata.<xsl:value-of select="."/></xsl:template-->
	<xsl:template match="indexFieldName">#if( $metadata.<xsl:value-of select="."/> != '' )$metadata.<xsl:value-of select="."/>#end</xsl:template>
	<xsl:template match="formula">
		<xsl:value-of select="."/>
	</xsl:template>
	<xsl:template name="extract">
		<xsl:param name="attribute"/>
		<xsl:choose>
			<xsl:when test="$attribute/indexFieldName != ''">$<xsl:value-of select="$attribute/indexFieldName"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:apply-templates select="$attribute"/>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
</xsl:transform>
